home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Belgian Amiga Club - ADF Collection
/
BS1 part 65.zip
/
BS1 part 65
/
Math Visin v2.1 disk 1.adf
/
Arexx.WB
/
Misc
/
AdjustColors
< prev
next >
Wrap
Text File
|
1992-02-12
|
2KB
|
93 lines
/* AdjustColors Do various transformations on MathVisions's Colors 19-Mar-90
This is simply an example of how to use the Color control via ARexx.
==========================================================================*/
ADDRESS "MathVision"
OPTIONS RESULTS
OPTIONS FAILAT 1
SIGNAL ON ERROR
Get Depth
NumColors = 2**RESULT
StopSign "F"
DO UNTIL Response = "X"
Response = Menu()
SELECT
WHEN Response = "G" THEN
DO
CALL GetDMAColors
DO i = 0 to NumColors-1
Get Color i
PARSE VAR RESULT Red Green Blue
Average = Round((Red + Green + Blue) / 3)
Color i Average Average Average
END
END
WHEN Response = "R" THEN
DO
CALL GetDMAColors
DO i = 0 to NumColors-1
Color NumColors-1-i DMAColorR.i DMAColorG.i DMAColorB.i
END
END
WHEN Response = "S" THEN
DO
CALL GetDMAColors
DO i = 1 to NumColors-1
Before = i-1; IF Before<0 THEN Before = NumColors-1
After = i+1; IF After>=NumColors THEN After = 0
Red = Round((DMAColorR.Before + DMAColorR.i + DMAColorR.After) / 3)
Green = Round((DMAColorG.Before + DMAColorG.i + DMAColorG.After) / 3)
Blue = Round((DMAColorB.Before + DMAColorB.i + DMAColorB.After) / 3)
Color i Red Green Blue
END
END
OTHERWISE;
END
Get StopSign
IF (RESULT = "T") THEN EXIT
END
EXIT
/*----------------------------------- Menu ------------------------------- */
Menu:
SAY d2c(12)
SAY "G - Gray"
SAY "S - Smooth ALL"
SAY "R - Reverse"
SAY "X - Exit"
OPTIONS PROMPT "Enter Selection: "
PULL RESPONSE
RETURN Response
/*------------------------------ GetDMAColors ---------------------------- */
GetDMAColors: PROCEDURE EXPOSE DMAColorR. DMAColorG. DMAColorB. NumColors
DO i = 0 to NumColors-1
Get Color i
PARSE VAR RESULT DMAColorR.i DMAColorG.i DMAColorB.i
END
RETURN ""
/*------------------------------ SetDMAColors ---------------------------- */
SetDMAColors: PROCEDURE EXPOSE DMAColorR. DMAColorG. DMAColorB. NumColors
DO i = 0 to NumColors-1
Color i DMAColorR.i DMAColorG.i DMAColorB.i
END
RETURN ""
ROUND: /* cheap trick to round argument to the nearest integer */
ARG ToRound
RETURN (ToRound+.5)%1
ERROR: /* Error Diagnostic for return codes */
Get Diagnosis RC
SAY RESULT" on line "SIGL
do i=0 to 500; end
EXIT